package com.hc.util;

import com.hc.bean.CacheBaseStationDataBean;

public class JudgeBaseStationJitterUtil {
	
	
 public static boolean JudgeBaseStationJitter(Integer[] message){
	 
	 
	 CacheBaseStationDataBean bean = CommonData.cacheBaseStationDataBeanMap.get(message[1]);
	 if(bean==null){
		 
		 CommonData.cacheBaseStationDataBeanMap.put(message[1], new CacheBaseStationDataBean(message[2], message[3], message[4], message[5], System.currentTimeMillis()));
	
		 return true;
	 }else{
		double len1 = Math.abs( bean.getLen1() - message[2])/((System.currentTimeMillis()- bean.getTime())/1000.0);
		double len2 = Math.abs( bean.getLen2() - message[3])/((System.currentTimeMillis()- bean.getTime())/1000.0);
		double len3 = Math.abs( bean.getLen3() - message[4])/((System.currentTimeMillis()- bean.getTime())/1000.0);
		double len4 = Math.abs( bean.getLen4() - message[5])/((System.currentTimeMillis()- bean.getTime())/1000.0);
		

		
		 if(len1>CommonData.baseStation_JN_1){
			 
			 return false;
		 }else if(len2>CommonData.baseStation_JN_2){
			 
			 return false;
		 }else if(len3>CommonData.baseStation_JN_3){
			 
			 return false;
		 }else if(len4>CommonData.baseStation_JN_4){
			 
			 return false;
		 }
		 CommonData.cacheBaseStationDataBeanMap.put(message[1], new CacheBaseStationDataBean(message[2], message[3], message[4], message[5], System.currentTimeMillis()));
	 }	
	 return true;
 }
}
